new Vue({
    el: '#app',
    data: {
        msg: '',
        member: {}
    },
    mounted() {
        var member = Cookies.get('member');
        if (member && member != null && member != '') {
            window.location.href = 'hou.html';
        }
    },
    methods: {
        login () {
            this.msg = '';
            var realname = this.member.realname;
            var phone = this.member.phone;
            if (!realname || trim(realname) === '') {
                this.msg = '请输入姓名！';
                return;
            }
            if (!phone || trim(phone) === '') {
                this.msg = '请输入手机号！';
                return;
            }
            getAjax().post('/web/login', toFormData({
                realname: realname,
                phone: phone
            })).then(res => {
                if (res.data.message === 'SUCCESS') {
                    Cookies.set('member', res.data.data);
                    window.location.href = 'hou.html';
                } else {
                    this.msg = res.data.message;
                }
            });
        }
    }
});
